CC = g++
LIBS = -lpthread

SRC = $(wildcard *.cpp)
OBJ = $(patsubst *.cpp, *.o, $(SRC))
SERVER_OBJ = server.o ThreadPool.o
CLIENT_OBJ = client.o


all: client server

client: $(CLIENT_OBJ)
	$(CC) -o client $(CLIENT_OBJ) $(LIBS)
server: $(SERVER_OBJ) 
	$(CC) -o server $(SERVER_OBJ) $(LIBS)

#$(SERVER_OBJ): %.o: %.cpp
#	$(CC) -g -c $< -o $@
#$(CLIENT_OBJ): %.o: %.cpp
#	$(CC) -g -c $< -o $@
$(OBJ): %.o: %.cpp
	$(CC) -g -c $< -o $@

.PHONY: clean
clean:
	-rm client server *.o
